home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / KERNEL_S.{3R < prev    next >
Text File  |  1999-09-17  |  1KB  |  51 lines

  1. #ifndef _LINUX_KERNEL_STAT_H
  2. #define _LINUX_KERNEL_STAT_H
  3.  
  4. #include <asm/irq.h>
  5. #include <linux/smp.h>
  6. #include <linux/tasks.h>
  7.  
  8. /*
  9.  * 'kernel_stat.h' contains the definitions needed for doing
  10.  * some kernel statistics (CPU usage, context switches ...),
  11.  * used by rstatd/perfmeter
  12.  */
  13.  
  14. #define DK_NDRIVE 4
  15.  
  16. struct kernel_stat {
  17.     unsigned int cpu_user, cpu_nice, cpu_system;    
  18.     unsigned int per_cpu_user[NR_CPUS],
  19.                  per_cpu_nice[NR_CPUS],
  20.                  per_cpu_system[NR_CPUS];
  21.     unsigned int dk_drive[DK_NDRIVE];
  22.     unsigned int dk_drive_rio[DK_NDRIVE];
  23.     unsigned int dk_drive_wio[DK_NDRIVE];
  24.     unsigned int dk_drive_rblk[DK_NDRIVE];
  25.     unsigned int dk_drive_wblk[DK_NDRIVE];
  26.     unsigned int pgpgin, pgpgout;
  27.     unsigned int pswpin, pswpout;
  28.     unsigned int irqs[NR_CPUS][NR_IRQS];
  29.     unsigned int ipackets, opackets;
  30.     unsigned int ierrors, oerrors;
  31.     unsigned int collisions;
  32.     unsigned int context_swtch;
  33. };
  34.  
  35. extern struct kernel_stat kstat;
  36.  
  37. /*
  38.  * Number of interrupts per specific IRQ source, since bootup
  39.  */
  40. extern inline int kstat_irqs (int irq)
  41. {
  42.     int i, sum=0;
  43.  
  44.     for (i = 0 ; i < smp_num_cpus ; i++)
  45.         sum += kstat.irqs[cpu_logical_map(i)][irq];
  46.  
  47.     return sum;
  48. }
  49.  
  50. #endif /* _LINUX_KERNEL_STAT_H */
  51.